import java.io.IOException;


/**
 * Klasse die keep a live berichten zend.
 * 
 * @author Jelle Polders
 *
 */
public class KeepAliveSender extends Thread{
	protected Multicaster multicaster;
	
	/**
	 * Constructor
	 * 
	 * @param multicaster het multicaster object
	 */
	public KeepAliveSender(Multicaster multicaster) {
		this.multicaster = multicaster;
	}

	/**
	 * De run-methode die door de thread uitgevoerd wordt.
	 */
	public void run() {
		while(true) {
			try {
				multicaster.send(new Message(MessageType.IK_LEEF, Message.VOOR_IEDEREEN));
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			try {
				Thread.sleep(5000);
			} catch (InterruptedException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
	
	
}
